//package com.etv.launcher.ui.actvity;
//
//import android.content.pm.ApplicationInfo;
//import android.content.pm.PackageManager;
//import android.graphics.drawable.Drawable;
//import android.os.Bundle;
//
//import androidx.leanback.app.VerticalGridFragment;
//import androidx.leanback.widget.ArrayObjectAdapter;
//import androidx.leanback.widget.VerticalGridPresenter;
//
//import com.etv.launcher.model.entity.ApplicationInfoEntity;
////import com.etv.launcher.ui.presenter.ApplicationPresenter;
//
//import java.util.List;
//
//public class ApplicationsFragment extends VerticalGridFragment {
//    private ArrayObjectAdapter adapter;
//
//    @Override
//    public void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//
//        // 1. 创建并配置 VerticalGridPresenter（1 列，仅垂直滚动）
//        VerticalGridPresenter gridPresenter = new VerticalGridPresenter();
//        gridPresenter.setNumberOfColumns(4);
//        setGridPresenter(gridPresenter);
//
//        // 2. 创建适配器并绑定自定义的 ApplicationPresenter
//        adapter = new ArrayObjectAdapter(new ApplicationPresenter());
//        setAdapter(adapter);
//
//        loadApplications();
//    }
//
//
//    private void loadApplications() {
//        PackageManager pm = getActivity().getPackageManager();
//        List<ApplicationInfo> apps = pm.getInstalledApplications(PackageManager.GET_META_DATA);
//
//        for (ApplicationInfo appInfo : apps) {
//            if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
//                String appName = pm.getApplicationLabel(appInfo).toString();
//                Drawable icon = pm.getApplicationIcon(appInfo);
//                Drawable banner = pm.getApplicationBanner(appInfo);
////                adapter.add(new ApplicationInfoEntity(appName, icon,banner,null));
//            }
//        }
//    }
//}
